<?php
class CodeSpace_Oauth_Server_Config extends Zend_Oauth_Config implements 
CodeSpace_Oauth_Server_Config_Interface
{

    protected $_nonce = null;

    protected $_timestamp = null;

    protected $_signature = null;
    
    protected $_consumer = null;
    
    protected $_token = null;
    
    protected $_userParams = array();

    public function __construct ($options = null)
    {
        $this->_consumer = new CodeSpace_Oauth_Server_Consumer();
        $this->_token = new CodeSpace_Oauth_Server_Token();
        parent::__construct($options);
    }

    public function setOptions (array $options)
    {
        foreach ($options as $key => $value)
        {
            switch ($key)
            {
                case 'oauth_consumer_key':
                    $this->_consumer->setKey($value);
                    break;
                case 'oauth_nonce':
                    $this->setNonce($value);
                    break;
                case 'oauth_signature_method':
                    $this->setSignatureMethod($value);
                    break;
                case 'oauth_timestamp':
                    $this->setTimestamp($value);
                    break;
                case 'oauth_version':
                    $this->setVersion($value);
                    break;
                case 'oauth_signature':
                    $this->setSignature($value);
                    break;
                case 'oauth_callback':
                    $this->setCallbackUrl($value);
                    break;
                case 'oauth_token':
                    $this->_token->setToken($value);
                    break;
                default:
                    $this->_userParams[$key] = $value;
                    break;
            }
        }
        return $this;
    }

    public function getUserParams()
    {
        return $this->_userParams;
    }
    
    public function setNonce ($nonce)
    {
        $this->_nonce = $nonce;
    }

    public function setTimestamp ($timestamp)
    {
        $this->_timestamp = $timestamp;
    }


    public function setSignature ($signature)
    {
        $this->_signature = $signature;
    }

    public function getNonce ()
    {
        return $this->_nonce;
    }

    public function getTimestamp ()
    {
        return $this->_timestamp;
    }


    public function getSignature ()
    {
        return $this->_signature;
    }
    
    public function getConsumer()
    {
        return $this->_consumer;
    }
    
    public function getToken()
    {
        return $this->_token;
    }
    
    public function setToken(Zend_Oauth_Token $token)
    {
        $this->_tokenm = $token;
    }
}
?>